var userAgent = navigator.userAgent.toLowerCase();
var isFireFox=/mozilla/.test(userAgent) && !/(compatible|webkit)/.test(userAgent);
	if(isFireFox)
	{
	    window.showModelessDialog=function (url)
	    {
	        var windowName=(arguments[1]==null?"_blank":arguments[1].toString());
	        //var feature=(arguments[2]==null?"":arguments[2].toString());
	        var iWidth=700; //窗口宽度
	        var iHeight=500;//窗口高度 
	        var iTop=(window.screen.height-iHeight)/2;
	        var iLeft=(window.screen.width-iWidth)/2;
	        var feature="Scrollbars=no,Toolbar=no,Location=no,Direction=no,Resizeable=no,Width="+iWidth+" ,Height="+iHeight+",top="+iTop+",left="+iLeft;
	        var OpenedWindow=window.open(url,windowName,feature);
	        window.addEventListener('click',function (){OpenedWindow.focus();},false);
	        return OpenedWindow;
	    }
	}else{
	    var originFn=window.showModelessDialog;
	    window.showModelessDialog=function (url)
	    {
	        var OpenedWindow= originFn(url,arguments[1],arguments[2]);
	        OpenedWindow.opener=window;
	    }
	}
	function popW(s){var OpenedWindow=window.showModelessDialog(s,'_blank','dialogWidth:700px;dialogHeight:500px;dialogLeft:200px;dialogTop:150px;center:yes;help:yes;resizable:yes;status:yes');}

	function codeAddress(){
		var province = document.getElementById('province').options[document.getElementById('province').selectedIndex].text;
		var city = document.getElementById('city').options[document.getElementById('city').selectedIndex].text;
		var area = document.getElementById('area').options[document.getElementById('area').selectedIndex].text;
		var address = document.getElementById("address").value;
		var mAddress = province + city + area + address;
		if(document.getElementById('province').value==0){
			popW('../ajax/maps.php?word=上海');
		}else if(mAddress){
			// 创建地址解析器实例
			var myGeo = new BMap.Geocoder();
			// 将地址解析结果显示在地图上，并调整地图视野
			myGeo.getPoint(mAddress, function(point){
			if (point) {	
			    var pointx = point.lng;//经度 
			    var pointy = point.lat;//纬度
			    if(pointx=="" || pointy==""){
			    	popW('../ajax/maps.php?word='+province);
			    }else{
			    	document.getElementById('lng').value=pointx;
			    	document.getElementById('lat').value=pointy;
			    }
			}}, province);
			
			
		}else{
			popW('../ajax/maps.php?word='+province);
		}
	}
	//打开弹出层
	function showMaps(){
		var province=document.getElementById('province').value;
		var city=document.getElementById('city').value;
		if(province == 0){
			ymPrompt.alert({title:'系统提示',message:'请选择所在地'});
		}else{
			var lat=document.getElementById('lat').value;
			var lng=document.getElementById('lng').value;
			var provinceValue = document.getElementById('province').options[document.getElementById('province').selectedIndex].text;
			popW('../ajax/maps.php?'+((lat!=""&&lng!="")?'lat='+lat+'&lng='+lng:'word='+provinceValue));
		}
	}
	function add_latlng(id1,lat,id2,lng){
		  document.getElementById(id1).value=lat;
		  document.getElementById(id2).value=lng;
	}
